﻿<storeControls:StoreApplicationPage x:Class="Store.WP7.Views.SettingsView"
                                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                                    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                                    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                                    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                                    xmlns:storeControls="clr-namespace:Store.WP7.Controls;assembly=Store.WP7.Controls"
                                    xmlns:behaviors="clr-namespace:Store.WP7.Framework.Interactions;assembly=Store.WP7.Framework"
                                    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                                    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                                    xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
                                    xmlns:live="clr-namespace:Microsoft.Live.Controls;assembly=Microsoft.Live.Controls"
                                    FontFamily="{StaticResource PhoneFontFamilyNormal}"
                                    FontSize="{StaticResource PhoneFontSizeNormal}"
                                    Foreground="{StaticResource PhoneForegroundBrush}"
                                    SupportedOrientations="Portrait"
                                    Orientation="Portrait"
                                    mc:Ignorable="d"
                                    d:DesignHeight="768"
                                    d:DesignWidth="480"
                                    DataContext="{Binding Source={StaticResource ViewModelLocator}, Path=SettingsViewModel}">

    <i:Interaction.Behaviors>
        <behaviors:SystrayBehavior SystrayOpacity="0.5"
                                   IsBusy="{Binding IsBusy}"
                                   BusyMessage="{Binding BusyMessage}" />
    </i:Interaction.Behaviors>

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn" />
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn" />
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut" />
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut" />
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <Grid x:Name="LayoutRoot"
          Background="Transparent">
        
        <Image Stretch="None"
               Source="/Assets/Images/PageBackground.png"
               VerticalAlignment="Top" />
        
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <StackPanel x:Name="TitlePanel"
                        Grid.Row="0"
                        Margin="12,112,0,12">
                <TextBlock x:Name="PageTitle"
                           Text="paramètres"
                           Margin="10,0,0,0"
                           Style="{StaticResource PhoneTextTitle1Style}" />
            </StackPanel>

            <Grid x:Name="ContentPanel"
                  Grid.Row="1"
                  Margin="0">

                <StackPanel Margin="12">
                    <toolkit:ToggleSwitch SwitchForeground="{StaticResource AccentBrushLight}"
                                          IsChecked="{Binding CanSendAnonymousReport, Mode=TwoWay}"
                                          Foreground="{StaticResource ForegroundBrush}"
                                          Header="envoi automatique et anonyme de rapports d'erreur pour aider à améliorer l'application"
                                          Margin="0,0,-24,0">
                        <toolkit:ToggleSwitch.HeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding}"
                                           TextWrapping="Wrap" />
                            </DataTemplate>
                        </toolkit:ToggleSwitch.HeaderTemplate>
                    </toolkit:ToggleSwitch>

                    <toolkit:ToggleSwitch SwitchForeground="{StaticResource AccentBrushLight}"
                                          IsChecked="{Binding CanUsePushData, Mode=TwoWay}"
                                          Foreground="{StaticResource ForegroundBrush}"
                                          Header="activer le push de données"
                                          Margin="0,0,-24,0">
                        <toolkit:ToggleSwitch.HeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding}"
                                           TextWrapping="Wrap" />
                            </DataTemplate>
                        </toolkit:ToggleSwitch.HeaderTemplate>
                    </toolkit:ToggleSwitch>

                    <toolkit:ToggleSwitch SwitchForeground="{StaticResource AccentBrushLight}"
                                          IsChecked="{Binding CanUseBackgroundAgent, Mode=TwoWay}"
                                          Foreground="{StaticResource ForegroundBrush}"
                                          Header="activer la mise à jour des tuiles"
                                          Margin="0,0,-24,0">
                        <toolkit:ToggleSwitch.HeaderTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding}"
                                           TextWrapping="Wrap" />
                            </DataTemplate>
                        </toolkit:ToggleSwitch.HeaderTemplate>
                    </toolkit:ToggleSwitch>

                    <TextBlock Text="synchronisation des paramètres avec skydrive :"
                               Foreground="{StaticResource ForegroundBrush}"
                               Margin="12,12,12,0"/>
                    <live:SignInButton SessionChanged="SignInButton_SessionChanged"
                                       ClientId="{Binding ClientId}"
                                       Scopes="{Binding RequiredScopes}"
                                       RedirectUri="https://oauth.live.com/desktop"
                                       Branding="Skydrive"
                                       TextType="Connect"/>
                    
                    <Button Style="{StaticResource ButtonStyle}"
                            Content="Kaboom !"
                            Margin="7,0,12,0">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <ec:CallMethodAction MethodName="Kaboom" TargetObject="{Binding Mode=OneWay}" />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>

                </StackPanel>
                
            </Grid>
        </Grid>
    </Grid>

</storeControls:StoreApplicationPage>
